home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM22.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-12  |  3KB  |  63 lines

  1. Program Exam22;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités StrCut?.                          }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1  ,
  14.   S2  : String;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Procedure   StrCut(Var Str1: String;Maxlen: Integer);                   }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Tronque la chaîne <Str1> à au maximum MaxLen caractères.    }
  21. {              Si la longueur de <Str1> est inférieure à <MaxLen> ,<Str1>  }
  22. {              demeure inchangée.                                          }
  23. {                                                                          }
  24. {  Usage     : Chaîne pascal.                                              }
  25. {                                                                          }
  26. {  Vitesse   : 7800/s                                                      }
  27. {                                                                          }
  28. { -------------------------------------------------------------------------}
  29.  
  30. Procedure Test1;
  31. Begin
  32.   S1  := 'abcdefghijklmnopqrstuvwxyz';
  33.   StrCut(S1,13);
  34.   StrCut(S1,45);
  35. end;
  36.  
  37. {  ---------------------------------------------------------------         }
  38. {  Function   StrCut_(Str1: String;Maxlen: Integer):String;                }
  39. {  ---------------------------------------------------------------         }
  40. {                                                                          }
  41. {  Effet     : Idem.                                                       }
  42. {                                                                          }
  43. {  Usage     : Chaîne pascal.                                              }
  44. {                                                                          }
  45. {  Vitesse   : 7800/s                                                      }
  46. {                                                                          }
  47. {  Note      : transformé en fonction,donc <Str1> n'est pas modifié.       }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1  := 'Turbo Pascal';
  53.   S2  := StrCut_(S1,5);
  54.   s2 := StrCut_(s1,45);
  55. end;
  56.  
  57. Begin
  58.   Test1;
  59.   Test2;
  60. End.
  61.  
  62. { -------------------------------------------------------------------------}
  63.